1 /*
2  *  Make.org Core API
3  *  Copyright (C) 2018 Make.org
4  *
5  * This program is free software: you can redistribute it and/or modify
6  *  it under the terms of the GNU Affero General Public License as
7  *  published by the Free Software Foundation, either version 3 of the
8  *  License, or (at your option) any later version.
9  *
10  *  This program is distributed in the hope that it will be useful,
11  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  *  GNU Affero General Public License for more details.
14  *
15  *  You should have received a copy of the GNU Affero General Public License
16  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.
17  *
18  */
19 
20 package org.make.api.technical.auth
21 
22 import org.make.api.user.PersistentUserServiceComponent
23 
24 import scala.concurrent.Future
25 
26 trait DefaultUserTokenGeneratorComponent extends UserTokenGeneratorComponent {
27   this: TokenGeneratorComponent with PersistentUserServiceComponent =>
28 
29   override lazy val userTokenGenerator: UserTokenGenerator = new DefaultUserTokenGenerator
30 
31   class DefaultUserTokenGenerator extends UserTokenGenerator {
32     override def generateVerificationToken(): Future[(String, String)] = {
33       tokenGenerator.generateToken(persistentUserService.verificationTokenExists)
34     }
35     override def generateResetToken(): Future[(String, String)] = {
36       tokenGenerator.generateToken(persistentUserService.resetTokenExists)
37     }
38 
39     override def generateReconnectToken(): Future[(String, String)] = {
40       tokenGenerator.generateToken(_ => Future.successful(false))
41     }
42   }
43 }
Line Stmt Id Pos Tree Symbol Tests Code
33 23161 1287 - 1332 Apply org.make.api.user.PersistentUserService.verificationTokenExists eta$0$1.verificationTokenExists(verificationToken)
33 24584 1258 - 1333 Apply org.make.api.technical.auth.TokenGenerator.generateToken qual$1.generateToken(x$1, x$2)
33 26839 1273 - 1273 Select org.make.api.technical.auth.TokenGenerator.generateToken$default$2 qual$1.generateToken$default$2
33 25354 1258 - 1272 Select org.make.api.technical.auth.TokenGeneratorComponent.tokenGenerator DefaultUserTokenGeneratorComponent.this.tokenGenerator
36 22381 1414 - 1428 Select org.make.api.technical.auth.TokenGeneratorComponent.tokenGenerator DefaultUserTokenGeneratorComponent.this.tokenGenerator
36 25048 1429 - 1429 Select org.make.api.technical.auth.TokenGenerator.generateToken$default$2 qual$1.generateToken$default$2
36 22712 1414 - 1482 Apply org.make.api.technical.auth.TokenGenerator.generateToken qual$1.generateToken(x$1, x$2)
36 27218 1443 - 1481 Apply org.make.api.user.PersistentUserService.resetTokenExists eta$0$1.resetTokenExists(resetToken)
40 25557 1602 - 1626 Apply scala.concurrent.Future.successful scala.concurrent.Future.successful[Boolean](false)
40 27142 1568 - 1627 Apply org.make.api.technical.auth.TokenGenerator.generateToken qual$1.generateToken(x$1, x$2)
40 26468 1568 - 1582 Select org.make.api.technical.auth.TokenGeneratorComponent.tokenGenerator DefaultUserTokenGeneratorComponent.this.tokenGenerator
40 23169 1583 - 1583 Select org.make.api.technical.auth.TokenGenerator.generateToken$default$2 qual$1.generateToken$default$2