fix(fe/login): login dialog small fixes

This commit is contained in:
hexxa 2022-01-23 17:56:33 +08:00 committed by Hexxa
parent b1accfdbee
commit 55f45b6c57
4 changed files with 15 additions and 46 deletions

View file

@ -119,12 +119,17 @@
height: 3.8rem; height: 3.8rem;
} }
.theme-default #pane-login input { .theme-default #pane-login input,
.theme-default #pane-login input:hover,
.theme-default #pane-login input:focus,
.theme-default #pane-login input:active {
width: 100%; width: 100%;
padding: 0; padding: 0;
border: none; border: none;
margin: 0 1rem; margin: 0 1rem;
background-color: transparent; background-color: transparent;
outline: none;
box-shadow: none;
} }
.theme-default #btn-login { .theme-default #btn-login {

View file

@ -14,7 +14,7 @@ import { colorClass } from "../visual/colors";
const defaultIconProps: IconProps = { const defaultIconProps: IconProps = {
name: "RiFolder2Fill", name: "RiFolder2Fill",
size: "1.6rem", size: "1.6rem",
color: `${colorClass("cyan1")}-font`, color: `${colorClass("cyan1")}`,
}; };
export interface Props { export interface Props {

View file

@ -33,6 +33,7 @@ export interface State {
user: string; user: string;
pwd: string; pwd: string;
captchaInput: string; captchaInput: string;
captchaLoaded: boolean;
} }
export class AuthPane extends React.Component<Props, State, {}> { export class AuthPane extends React.Component<Props, State, {}> {
@ -44,6 +45,7 @@ export class AuthPane extends React.Component<Props, State, {}> {
user: "", user: "",
pwd: "", pwd: "",
captchaInput: "", captchaInput: "",
captchaLoaded: false,
}; };
} }
@ -153,11 +155,15 @@ export class AuthPane extends React.Component<Props, State, {}> {
placeholder={this.props.msg.pkg.get("login.captcha")} placeholder={this.props.msg.pkg.get("login.captcha")}
/> />
</div>, </div>,
<img <img
id="captcha" id="captcha"
src={`/v1/captchas/imgs?capid=${this.props.login.captchaID}`} src={`/v1/captchas/imgs?capid=${this.props.login.captchaID}`}
className="captcha" className={`captcha ${
this.state.captchaLoaded ? "" : "hidden"
}`}
onClick={this.refreshCaptcha} onClick={this.refreshCaptcha}
onLoad={() => this.setState({ captchaLoaded: true })}
/>, />,
])} ])}
childrenStyles={List([ childrenStyles={List([

View file

@ -471,48 +471,6 @@ export class Updater {
return ""; return "";
}; };
initStateForVisitor = async (): Promise<any> => {
const status = await this.getClientCfg();
if (status !== "") {
return status;
}
const syncLanStatus = await this.syncLan();
if (syncLanStatus !== "") {
return syncLanStatus;
}
return "";
};
initStateForAuthedUser = async (): Promise<string> => {
const statuses = await Promise.all([
this.refreshUploadings(),
this.listSharings(),
]);
if (statuses.join("") !== "") {
return statuses.join(";");
}
this.initUploads();
return "";
};
initStateForAdmin = async (): Promise<string> => {
const initVisitorStatus = await this.initStateForVisitor();
if (initVisitorStatus !== "") {
return initVisitorStatus;
}
const initAuthedUserStatus = await this.initStateForAuthedUser();
if (initAuthedUserStatus !== "") {
return initAuthedUserStatus;
}
const statuses = await Promise.all([this.listRoles(), this.listUsers()]);
if (statuses.join("") !== "") {
return statuses.join(";");
}
return "";
};
syncCwd = async (): Promise<string> => { syncCwd = async (): Promise<string> => {
if (this.props.filesInfo.dirPath.size !== 0) { if (this.props.filesInfo.dirPath.size !== 0) {
return this.setItems(this.props.filesInfo.dirPath); return this.setItems(this.props.filesInfo.dirPath);
@ -584,7 +542,7 @@ export class Updater {
const isInSharingMode = this.props.ui.control.controls.get(sharingCtrl); const isInSharingMode = this.props.ui.control.controls.get(sharingCtrl);
if ( if (
(this.props.login.userRole === roleVisitor && (this.props.login.userRole === roleVisitor &&
isInSharingMode !== ctrlOn) || isInSharingMode === ctrlOn) ||
this.props.login.userRole === roleUser || this.props.login.userRole === roleUser ||
this.props.login.userRole === roleAdmin this.props.login.userRole === roleAdmin
) { ) {