Skip to content

Commit bdead0e

Browse files
robkooperlmarini
andauthored
Fix user count (#158)
* increment user count (fixes #136) * fix urls for login services * add note about fixcount script Co-authored-by: Luigi Marini <[email protected]>
1 parent a6c16c6 commit bdead0e

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,16 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
66

77
## Unreleased
88

9+
Google will no longer work as login provider, we are working on this issue #157.
10+
11+
If non local accounts are used the count can be wrong. Use the [fixcounts](https://github.com/clowder-framework/clowder/blob/develop/scripts/updates/fix-counts.js)
12+
script to fix this.
13+
914
### Fixed
15+
- Error logging in with orcid due to changed URL #91
16+
- Fixed error in url for twitter login
17+
- Count of users is not correct if using anything else but local accounts #136
1018
- Files were not properly reindexed when the Move button was used to move a file into or out of a folder in a dataset.
11-
This has been fixed.
1219
- When adding a file to a dataset by URL, prioritize the URL `content-type` header over the file content type established
1320
by looking at the file name extension.
1421

app/services/SecureSocialEventListener.scala

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ import securesocial.core.providers.UsernamePasswordProvider
1010

1111
class SecureSocialEventListener(app: play.api.Application) extends EventListener {
1212
override def id: String = "SecureSocialEventListener"
13+
lazy val userService: UserService = DI.injector.getInstance(classOf[UserService])
14+
lazy val spaceService: SpaceService = DI.injector.getInstance(classOf[SpaceService])
15+
lazy val appConfig: AppConfigurationService = DI.injector.getInstance(classOf[AppConfigurationService])
1316

1417
def onEvent(event: Event, request: RequestHeader, session: Session): Option[Session] = {
15-
val userService: UserService = DI.injector.getInstance(classOf[UserService])
16-
val spaceService: SpaceService = DI.injector.getInstance(classOf[SpaceService])
17-
1818
event match {
1919
case e: SignUpEvent => {
2020
userService.findByIdentity(event.user) match {
@@ -40,6 +40,7 @@ class SecureSocialEventListener(app: play.api.Application) extends EventListener
4040
val subject = s"[${AppConfiguration.getDisplayName}] new user signup"
4141
val body = views.html.emails.userSignup(user)(request)
4242
util.Mail.sendEmailAdmins(subject, Some(user), body)
43+
appConfig.incrementCount('users, 1)
4344
}
4445
user.email match {
4546
case Some(e) => spaceService.processInvitation(e)

conf/securesocial.conf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,9 @@ securesocial {
7979
ssl=false
8080

8181
twitter {
82-
requestTokenUrl="https://twitter.com/oauth/request_token"
83-
accessTokenUrl="https://twitter.com/oauth/access_token"
84-
authorizationUrl="https://twitter.com/oauth/authenticate"
82+
requestTokenUrl="https://api.twitter.com/oauth/request_token"
83+
accessTokenUrl="https://api.twitter.com/oauth/access_token"
84+
authorizationUrl="https://api.twitter.com/oauth/authorize"
8585
consumerKey=your_consumer_key
8686
consumerSecret=your_consumer_secret
8787
}
@@ -135,7 +135,7 @@ securesocial {
135135

136136
orcid {
137137
authorizationUrl="https://orcid.org/oauth/authorize"
138-
accessTokenUrl="https://pub.orcid.org/oauth/token"
138+
accessTokenUrl="https://orcid.org/oauth/token"
139139
clientId=your_client_id
140140
clientSecret=your_client_secret
141141
scope="/authenticate"

0 commit comments

Comments
 (0)