Skip to content

Binary to edit a user's password#383

Closed
marceloschmidt wants to merge 1 commit intodocker-mailserver:masterfrom
marceloschmidt:master
Closed

Binary to edit a user's password#383
marceloschmidt wants to merge 1 commit intodocker-mailserver:masterfrom
marceloschmidt:master

Conversation

@marceloschmidt
Copy link
Copy Markdown

I'm not sure if this is the best bash script it can be, but it works for me.
This script changes a user password.
We still need to restart the server for changes to be taken into account.

@Josef-Friedrich
Copy link
Copy Markdown
Contributor

related to #357

@Influencer
Copy link
Copy Markdown
Contributor

Just a suggestion, sed will do all the work in a single line. Try this out:

Remove lines 9-13(the sed_string function), remove 31 and replace line 32 from
sed -i "s/${SED_STRING}" $DATABASE
to
sed -i.bak "s%^$USER.*%$ENTRY%g" $DATABASE

That should search the database for $user and replace the line with the new $ENTRY. I added the .bak in case the user made a mistake and needed to rollback the change.

The only issue I could think of is if % was in the encryption. As far as I've been able to tell and test, I have not come across it so I don't believe would be.

Also should update setup.sh to include the usage for:
$0 email update <email> <password>

and add the case:

update)
    shift
    _docker_image editmailuser $@
    ;;

Let me know if I can make a pull request for anything to help.

@Josef-Friedrich
Copy link
Copy Markdown
Contributor

@marceloschmidt Thank you for submitting your script! Can you please write a test. Writing tests with bats is so nice.

@marceloschmidt
Copy link
Copy Markdown
Author

I'll have to learn some bash programming 😂 but give me a few days and I'll add some tests! Thanks!

@tomav
Copy link
Copy Markdown
Contributor

tomav commented Nov 25, 2016

Yeah, no problem @marceloschmidt

@tomav
Copy link
Copy Markdown
Contributor

tomav commented Dec 20, 2016

Hi @marceloschmidt, did you get a chance to look at batsintegration test?
We can help you if necessary. Feel free to ask. Tests are important to make this robust to changes.

@tomav
Copy link
Copy Markdown
Contributor

tomav commented Dec 25, 2016

Fixed by #413

@tomav tomav closed this Dec 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants