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("/")){
|
if(redirect.isDefined && redirect.get.startsWith("/")){
|
||||||
flash += Keys.Flash.Redirect -> redirect.get
|
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 =>
|
post("/signin", signinForm){ form =>
|
||||||
authenticate(context.settings, form.userName, form.password) match {
|
authenticate(context.settings, form.userName, form.password) match {
|
||||||
case Some(account) => signin(account)
|
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"){
|
@gitbucket.core.html.main("Sign in"){
|
||||||
<div class="content-wrapper main-center">
|
<div class="content-wrapper main-center">
|
||||||
<div class="content body">
|
<div class="content body">
|
||||||
@@ -9,7 +11,8 @@
|
|||||||
@Html(information)
|
@Html(information)
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
@gitbucket.core.html.signinform(context.settings)
|
@gitbucket.core.helper.html.error(error)
|
||||||
|
@gitbucket.core.html.signinform(context.settings, userName, password)
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</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 panel-default">
|
||||||
<div class="panel-heading strong">Sign in</div>
|
<div class="panel-heading strong">Sign in</div>
|
||||||
<ul class="list-group list-group-flush">
|
<ul class="list-group list-group-flush">
|
||||||
@@ -7,12 +9,12 @@
|
|||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="userName">Username:</label>
|
<label for="userName">Username:</label>
|
||||||
<span id="error-userName" class="error"></span>
|
<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>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="password">Password:</label>
|
<label for="password">Password:</label>
|
||||||
<span id="error-password" class="error"></span>
|
<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>
|
</div>
|
||||||
<input type="submit" class="btn btn-success" value="Sign in"/>
|
<input type="submit" class="btn btn-success" value="Sign in"/>
|
||||||
@if(systemSettings.allowAccountRegistration){
|
@if(systemSettings.allowAccountRegistration){
|
||||||
|
|||||||
Reference in New Issue
Block a user