Skip to content

Commit

Permalink
feat: admin console
Browse files Browse the repository at this point in the history
  • Loading branch information
danimaniarqsoft committed Oct 2, 2023
1 parent 9807a9b commit 1826703
Show file tree
Hide file tree
Showing 16 changed files with 1,242 additions and 1,427 deletions.
2,054 changes: 1,027 additions & 1,027 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion src/main/docker/app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,16 @@ services:
- SPRING_DATA_MONGODB_DATABASE=chatbot
- JHIPSTER_SLEEP=30 # gives time for other services to boot before the application
ports:
- 8080:8080
- 8081:8080
depends_on:
- bot-mongodb
bot-mongodb:
image: mongo:3.6.14
environment:
- MONGO_DATA_DIR=/data/db
- MONGO_LOG_DIR=/dev/null
ports:
- 27017:27017
volumes:
- ./data/db:/data/db
command: mongod --smallfiles --logpath=/dev/null # --quiet
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ public class UserService {

private final CacheManager cacheManager;

public static final String TEMPORAL_KEY = "temporal.p4ssword";

public UserService(UserRepository userRepository, PasswordEncoder passwordEncoder, AuthorityRepository authorityRepository, CacheManager cacheManager) {
this.userRepository = userRepository;
this.passwordEncoder = passwordEncoder;
Expand Down Expand Up @@ -144,7 +146,7 @@ public User createUser(UserDTO userDTO) {
} else {
user.setLangKey(userDTO.getLangKey());
}
String encryptedPassword = passwordEncoder.encode(RandomUtil.generatePassword());
String encryptedPassword = passwordEncoder.encode(TEMPORAL_KEY);
user.setPassword(encryptedPassword);
user.setResetKey(RandomUtil.generateResetKey());
user.setResetDate(Instant.now());
Expand Down
45 changes: 27 additions & 18 deletions src/main/java/com/github/danimaniarqsoft/web/rest/UserResource.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,31 @@
package com.github.danimaniarqsoft.web.rest;

import java.net.URI;
import java.net.URISyntaxException;
import java.util.List;
import java.util.Optional;

import javax.validation.Valid;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.support.ServletUriComponentsBuilder;

import com.github.danimaniarqsoft.config.Constants;
import com.github.danimaniarqsoft.domain.User;
import com.github.danimaniarqsoft.repository.UserRepository;
Expand All @@ -15,23 +41,6 @@
import io.github.jhipster.web.util.PaginationUtil;
import io.github.jhipster.web.util.ResponseUtil;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.support.ServletUriComponentsBuilder;

import javax.validation.Valid;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.*;

/**
* REST controller for managing users.
* <p>
Expand Down Expand Up @@ -104,7 +113,7 @@ public ResponseEntity<User> createUser(@Valid @RequestBody UserDTO userDTO) thro
throw new EmailAlreadyUsedException();
} else {
User newUser = userService.createUser(userDTO);
mailService.sendCreationEmail(newUser);
//mailService.sendCreationEmail(newUser);
return ResponseEntity.created(new URI("/api/users/" + newUser.getLogin()))
.headers(HeaderUtil.createAlert(applicationName, "userManagement.created", newUser.getLogin()))
.body(newUser);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,5 +136,4 @@
</div>
</template>

<script lang="ts" src="./change-password.component.ts">
</script>
<script lang="ts" src="./change-password.component.ts"></script>
Loading

0 comments on commit 1826703

Please sign in to comment.