mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-04 20:45:58 +01:00
Show login failed message
This commit is contained in:
@@ -49,13 +49,18 @@ trait IndexControllerBase extends ControllerBase {
|
||||
if(redirect.isDefined && redirect.get.startsWith("/")){
|
||||
flash += Keys.Flash.Redirect -> redirect.get
|
||||
}
|
||||
gitbucket.core.html.signin()
|
||||
gitbucket.core.html.signin(flash.get("userName"), flash.get("password"), flash.get("error"))
|
||||
}
|
||||
|
||||
post("/signin", signinForm){ form =>
|
||||
authenticate(context.settings, form.userName, form.password) match {
|
||||
case Some(account) => signin(account)
|
||||
case None => redirect("/signin")
|
||||
case None => {
|
||||
flash += "userName" -> form.userName
|
||||
flash += "password" -> form.password
|
||||
flash += "error" -> "Sorry, your Username and/or Password is incorrect. Please try again."
|
||||
redirect("/signin")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
@()(implicit context: gitbucket.core.controller.Context)
|
||||
@(userName: Option[Any] = None,
|
||||
password: Option[Any] = None,
|
||||
error: Option[Any] = None)(implicit context: gitbucket.core.controller.Context)
|
||||
@gitbucket.core.html.main("Sign in"){
|
||||
<div class="content-wrapper main-center">
|
||||
<div class="content body">
|
||||
@@ -9,7 +11,8 @@
|
||||
@Html(information)
|
||||
</div>
|
||||
}
|
||||
@gitbucket.core.html.signinform(context.settings)
|
||||
@gitbucket.core.helper.html.error(error)
|
||||
@gitbucket.core.html.signinform(context.settings, userName, password)
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
@(systemSettings: gitbucket.core.service.SystemSettingsService.SystemSettings)(implicit context: gitbucket.core.controller.Context)
|
||||
@(systemSettings: gitbucket.core.service.SystemSettingsService.SystemSettings,
|
||||
userName: Option[Any] = None,
|
||||
password: Option[Any] = None)(implicit context: gitbucket.core.controller.Context)
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading strong">Sign in</div>
|
||||
<ul class="list-group list-group-flush">
|
||||
@@ -7,12 +9,12 @@
|
||||
<div class="form-group">
|
||||
<label for="userName">Username:</label>
|
||||
<span id="error-userName" class="error"></span>
|
||||
<input type="text" name="userName" id="userName" class="form-control" autofocus/>
|
||||
<input type="text" name="userName" id="userName" class="form-control" autofocus value="@userName"/>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="password">Password:</label>
|
||||
<span id="error-password" class="error"></span>
|
||||
<input type="password" name="password" id="password" class="form-control"/>
|
||||
<input type="password" name="password" id="password" class="form-control" value="@password"/>
|
||||
</div>
|
||||
<input type="submit" class="btn btn-success" value="Sign in"/>
|
||||
@if(systemSettings.allowAccountRegistration){
|
||||
|
||||
Reference in New Issue
Block a user