-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
295 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
modules/core/app/com/elogiclab/guardbee/core/RegistrationController.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/** | ||
* Copyright (c) 2014 Marco Sarti <marco.sarti at gmail.com> | ||
* | ||
* Permission is hereby granted, free of charge, to any person | ||
* obtaining a copy of this software and associated documentation | ||
* files (the "Software"), to deal in the Software without | ||
* restriction, including without limitation the rights to use, | ||
* copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the | ||
* Software is furnished to do so, subject to the following | ||
* conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be | ||
* included in all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES | ||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT | ||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | ||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
* OTHER DEALINGS IN THE SOFTWARE. | ||
* | ||
*/ | ||
package com.elogiclab.guardbee.core | ||
|
||
import play.api.mvc.Controller | ||
|
||
/** | ||
* @author Marco Sarti | ||
* | ||
*/ | ||
object RegistrationController extends Controller { | ||
|
||
} |
72 changes: 72 additions & 0 deletions
72
modules/core/app/com/elogiclab/guardbee/core/RegistrationService.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/** | ||
* Copyright (c) 2014 Marco Sarti <marco.sarti at gmail.com> | ||
* | ||
* Permission is hereby granted, free of charge, to any person | ||
* obtaining a copy of this software and associated documentation | ||
* files (the "Software"), to deal in the Software without | ||
* restriction, including without limitation the rights to use, | ||
* copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the | ||
* Software is furnished to do so, subject to the following | ||
* conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be | ||
* included in all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES | ||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT | ||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | ||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
* OTHER DEALINGS IN THE SOFTWARE. | ||
* | ||
*/ | ||
package com.elogiclab.guardbee.core | ||
|
||
import play.api.Application | ||
import play.api.Plugin | ||
import org.joda.time.DateTime | ||
|
||
/** | ||
* @author Marco Sarti | ||
* | ||
*/ | ||
|
||
trait RegistrationToken { | ||
self => | ||
|
||
|
||
def email: String | ||
def token: String | ||
def expirationTime: DateTime | ||
|
||
|
||
def isExpired = DateTime.now.isAfter(self.expirationTime) | ||
|
||
|
||
} | ||
|
||
class RegistrationServiceConfig(app: Application) extends Configuration(app) { | ||
|
||
} | ||
|
||
|
||
|
||
|
||
|
||
abstract class RegistrationService(app: Application) extends RegistrationServiceConfig(app) with Plugin { | ||
|
||
|
||
def findTokenByEmail(email: String): Option[RegistrationToken] | ||
def consumeToken(token: String): Option[RegistrationToken] | ||
def saveToken(token: RegistrationToken): RegistrationToken | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
modules/core/app/com/elogiclab/guardbee/core/views/login_form.scala.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
@* login_form Template File *@ | ||
@(authenticator: String, dest: String)(implicit lang: Lang) | ||
@import com.elogiclab.guardbee.core.RoutesHelper | ||
<form role="form" class="hidden login-form" id="@authenticator-login-form" name="@authenticator-login-form" action='@RoutesHelper.login(authenticator, Some(dest))' method="post"> | ||
<div class="form-group"> | ||
<label class="control-label" for="@authenticator-username">@Messages("guardbee.label.username")</label> <input name="username" class="form-control" id="@authenticator-username" placeholder="Username" type="text"> | ||
</div> | ||
|
||
<div class="form-group"> | ||
<label for="@authenticator-password" class="control-label">@Messages("guardbee.label.password")</label> <input name="password" class="form-control" id="@authenticator-password" placeholder="******" type="password"> | ||
</div> | ||
|
||
<div class="form-group"> | ||
<button type="submit" class="btn btn-primary btn-block">@Messages("guardbee.label.login-with-"+authenticator)</button> | ||
</div> | ||
|
||
<div class="row"> | ||
<div class="col-xs-6 col-md-8"> | ||
<div class="checkbox"> | ||
<label><input checked="checked" type="checkbox" value="true" name="remember-me" id="@authenticator-rememeber-me"> @Messages("guardbee.label.remember-me")</label> | ||
</div> | ||
</div> | ||
</div> | ||
</form> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.